No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage and retrieval system, without permission in writing from the publisher. However, you are permitted to make copies of this work, printed or otherwise, as long as said copies are for your personal use only.
Introduction
------------
If you are looking for small but useful script examples, you've come to the right place. This edition of Snippet Show introduces three new snippets, described in detail below. Feel free to use any of these snippets in your own creations, or modify them to suit your needs. Click the "Clips" button to display four new buttons: prompt, wait, append, and Back. The prompt button will show you the GetPrompt script. The wait button will show you the WaitNextLine script. The append button will show you the AppendSelection script. Finally, the Back button will return you to the original set of buttons on the button bar.
Snippets
--------
GetPrompt - this snippet attempts to get a prompt from the host. The prompt is usually a general place where the user can issue a command. For example, the prompt might be something like "Please enter a command: ". GetPrompt keeps a list of known prompts and has a set of responses for those prompts. Just edit the contents of the prompt variable and you should be able to get this script to work on just about any host.
WaitNextLine - this snippet waits until it receives a carriage return in the stream, or until three seconds have passed. It is useful for situations when you have sent the host a piece of information, and do not want to continue until the host has processed the information and sent back a carriage return. The three second timeout allows you to escape in the event that the host does not send a carriage return.
AppendSelection - this snippet takes the selected contents of the terminal window and appends it to a text file that the user chooses. It puts a line of dashes at the beginning of each selection that you append to the file, to mark where the new addition to file begins.